package org.goyo.main.domain.dao.system.impl;
import org.goyo.common.exception.DBException;
import org.goyo.common.utils.Pager;
import org.goyo.main.domain.dao.BaseDAO;
import org.goyo.main.domain.dao.system.ISystemDao;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class SystemDaoImpl extends BaseDAO implements ISystemDao {

  @Override
  public Pager findByCondition(String where, Pager pager) throws DBException {
    StringBuffer buf = new StringBuffer("from SysLog where 1=1 ");
    buf.append(" and ");
    buf.append(where);
    String hql = this.addSort(buf, pager);
    String countHql = "select count(*) "+buf.toString();
    return this.findObjectsByPager(hql,countHql, pager);
  }
}